package com.ssm.web.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class SessionValidateFilter implements Filter {

	private static final Log log = LogFactory.getLog(SessionValidateFilter.class);

	public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {

		HttpServletRequest request = (HttpServletRequest) req;


		String queryString = request.getQueryString();
		String requestUri = request.getRequestURI();
		
		System.out.println(queryString + requestUri);

		log.debug("validate authentication finished, the authentication has permission to enter this uri.");
		chain.doFilter(req, res);

	}

	public void init(FilterConfig config) throws ServletException {
		System.out.println("SessionValidateFilter.init()");
	}

	@Override
	public void destroy() {
		
	}
}
